<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateImageMovieTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('image_movie', function (Blueprint $table) {
            $table->increments('id');
            $table->unsignedInteger('image_id')->index();
            $table->foreign('image_id')->references('id')->on('images');

            $table->unsignedInteger('movie_id')->index();
            $table->foreign('movie_id')->references('id')->on('movies');

            $table->longText('detail');

        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('image_movie');
    }
}
